package com.wentjiang;

import freemarker.template.Configuration;
import freemarker.template.Template;
import freemarker.template.TemplateException;

import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.util.Map;

/**
 * Created by jiangwentao on 7/20/2016.
 */
public class TestUse {
    public static void main(String[] args) {
        Configuration cfg = CFGfactory.getInstance();
        try {
            Template template = cfg.getTemplate("test.ftl");
            Writer out = new OutputStreamWriter(System.out);
            Map root = new DataModel().getDefaultDataModel();
            template.process(root, out);
        } catch (IOException e) {
            e.printStackTrace();
        } catch (TemplateException e) {
            e.printStackTrace();
        }


    }
}
